var width;
var now = new Date();
var year = now.getYear();
var month = now.getMonth() + 1;
var day = new Date(year, month, 0);
var date_last = 1900 + year + '-' + month + '-01';
var date = 1900 + year + '-' + month + '-' + day.getDate();
var date_now = 1900 + year + "-" + month + "-" + now.getDate();
$(function () {
	paylineFrame();
	var screeninfo = document.getElementById("screeninfo");
	var screenh1 = document.getElementsByTagName('h1');
	var screenh2 = document.getElementsByTagName('h2');
	var payline_checkbox = document.getElementsByName('payline_checkbox');
	var newcontent = "";
	for (var i = 0; i < screenh1.length; i++) {
		screenh1[i].onclick = function () {
			var siblings = this.parentNode.children;
			for (var j = 0; j < siblings.length; j++) {
				siblings[j].className = '';
			}
			this.className = 'on';
			if (this.parentNode.id == "datetype") {
				payeddateflag = this.title;
			}
			if (this.parentNode.id == "payeddate_date_cycle") {
				payeddate_cycle_flag = this.title;
			}
			if (this.parentNode.id == "accuracy_amount") {
				amount_flag = this.title;
			}
			resetsc();
		};
	};
	for (var i = 0; i < screenh2.length; i++) {
		screenh2[i].onclick = function () {
			var siblings = this.parentNode.children;
			this.className = 'on';
			if (this.parentNode.id == "paytype") {
				if (this.checked == true) {
					this.checked = false;
					this.className = '';
				} else {
					this.checked = true;
				}
				payline_ck();
			}
			resetsc();
		};
	};
	resetsc();
	$("#symbol_pl,#paystatus_pl").combobox({
		onChange: function (n, o) {
			resetsc();
		}
	});
});

function resetsc() {
	var screeninfo = document.getElementById("screeninfo");
	var screenh1 = document.getElementsByTagName('h1');
	var screenh2 = document.getElementsByTagName('h2');
	screeninfo.innerHTML = "";
	for (var i = 0; i < screenh1.length; i++) {
		if (screenh1[i].className == "on") {
			screeninfo.innerHTML += "<div class='haschoose' align='center'>" + screenh1[i].innerHTML + "</div>";
		}
	}
	for (var i = 0; i < screenh2.length; i++) {
		if (screenh2[i].className == "on") {
			screeninfo.innerHTML += "<div class='haschoose' align='center'>" + screenh2[i].innerHTML + "</div>";
		}
	}

	var datebox1_pl = $("#datebox1_pl").datebox("getValue");
	var datebox2_pl = $("#datebox2_pl").datebox("getValue");
	screeninfo.innerHTML += "<div class='haschoose' align='center' style='width: 160px;'><label>" + datebox1_pl + "</label>~<label>" + datebox2_pl + "</label></div>";

	var symbol_pl = $("#symbol_pl").combobox("getText");
	var paystatus_pl = $("#paystatus_pl").combobox("getText");
	if (symbol_pl == "" || paystatus_pl == "") {
	} else {
		screeninfo.innerHTML += "<div class='haschoose' align='center' style='width: 160px;'><label>" + symbol_pl + "</label>|<label>" + paystatus_pl + "</label></div>";
	}
}
function resetall() {
	var screeninfo = document.getElementById("screeninfo");
	var screenh1 = document.getElementsByTagName('h1');
	var screenh2 = document.getElementsByTagName('h2');
	screeninfo.innerHTML = "";
	for (var i = 0; i < screenh1.length; i++) {
		screenh1[i].className = '';
	}
	screenh1[0].className = 'on';//按缴存日期
	screenh1[4].className = 'on';//按日
	screenh1[5].className = 'on';//实际金额
	for (var i = 0; i < screenh2.length; i++) {
		screenh2[i].className = '';
	}

	payeddateflag = 1, payeddate_cycle_flag = 3, amount_flag = 1;
	payline_checkbox[0].checked = false;
	payline_checkbox[1].checked = false;
	payline_checkbox[2].checked = false;
	$("#symbol_pl").combobox("setValue", "");
	$("#paystatus_pl").combobox("setValue", "");
	$("#datebox1_pl").datebox("setValue", date_last);
	$("#datebox2_pl").datebox("setValue", date);
	resetsc();
}
function startcount_payline_new() {
	startcount_payline();
	closewin();
}